package com.yunjian.admin.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import java.util.Date;
import java.util.List;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.PageInfo;
import com.yunjian.admin.vo.Constant;
import com.yunjian.admin.vo.HouseVo;
import com.yunjian.admin.vo.WebResult;
import com.yunjian.core.basic.model.SUser;
import com.yunjian.core.basic.service.CacheService;
import com.yunjian.core.basic.service.SDataDicService;
import com.yunjian.core.basic.service.SequenceService;
import com.yunjian.core.basic.service.UserLogService;
import com.yunjian.core.busi.model.HouseBasicInfo;
import com.yunjian.core.busi.model.HouseBasicInfoExample;
import com.yunjian.core.busi.model.HouseFolow;
import com.yunjian.core.busi.model.HouseFolowExample;
import com.yunjian.core.busi.model.HousePropertyInfo;
import com.yunjian.core.busi.model.HousePropertyInfoExample;
import com.yunjian.core.busi.model.HouseRentInfo;
import com.yunjian.core.busi.model.HouseRentInfoExample;
import com.yunjian.core.busi.service.EmployeeService;
import com.yunjian.core.busi.service.HouseBasicInfoService;
import com.yunjian.core.busi.service.HouseFolowService;
import com.yunjian.core.busi.service.HousePropertyInfoService;
import com.yunjian.core.busi.service.HouseRentInfoService;
import com.yunjian.core.busi.vo.HouseBasicInfoVo;
import com.yunjian.core.busi.vo.HouseFolowVo;
import com.yunjian.util.BeanUtil;
import com.yunjian.util.StringUtil;

/**
 * 房源管理控制器
 * @author sonta
 *
 */
@Controller
@RequestMapping("/house")
@Api(description="房源管理模块")
public class HouseController {
	private static final Logger logger = LoggerFactory.getLogger(HouseController.class);

	@Autowired
	private CacheService cacheService;
	@Autowired
	private UserLogService userLogService;
	@Autowired
	private SDataDicService sDataDicService;
	@Autowired
	private HouseBasicInfoService houseBasicInfoService;
	@Autowired
	private HouseRentInfoService houseRentInfoService;
	@Autowired
	private HousePropertyInfoService housePropertyInfoService;
	@Autowired
	private HouseFolowService houseFolowService;
	@Autowired
	private EmployeeService employeeService;
	@Autowired
	private SequenceService sequenceService;
	
	

	/**
	 * 房源录入
	 * @param basic
	 * @return
	 */
	@ApiOperation(value="房源录入")
	@RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
	@ResponseBody
	@RequiresPermissions("house:add")
	public WebResult<String> add(HouseBasicInfo basic, HouseRentInfo rent, HousePropertyInfo property, @ApiParam(value="产权-备注")String propertyRemark) {
		WebResult<String> ret = new WebResult<>();
		SUser user = (SUser)SecurityUtils.getSubject().getPrincipal();
		logger.info("用户[{}]录入房源信息", user.getUserId());
		logger.debug("basic-{}\n rent-{}\n proerty-{}\n propertyRemark-{}", BeanUtil.getFieldsAsString(basic, true), BeanUtil.getFieldsAsString(rent, true), BeanUtil.getFieldsAsString(property, true), propertyRemark);
		String houseId = sequenceService.genFyNo();
		basic.setId(houseId);
		basic.setCreateTime(new Date());
		basic.setModTime(basic.getCreateTime());
		basic.setDelFlag(0);
		basic.setUserId(user.getUserId());
		
		rent.setId(basic.getId());
		rent.setCreateTime(basic.getCreateTime());
		rent.setModTime(basic.getModTime());
		rent.setDelFlag(basic.getDelFlag());
		rent.setUserId(user.getUserId());
		
		property.setId(basic.getId());
		property.setCreateTime(basic.getCreateTime());
		property.setModTime(basic.getModTime());
		property.setDelFlag(basic.getDelFlag());
		property.setUserId(basic.getUserId());
		property.setRemark(propertyRemark);
		
		int up = houseBasicInfoService.insertSelective(basic);
		if (up != 1) {
			ret.setCoder(WebResult.Coder.C2001);
			logger.error("用户[{}]新增房源基本信息-{}", user.getUserId(), ret.getMsg());
			return ret;
		}
		// TODO 以后可以考虑使用事务
		up = houseRentInfoService.insertSelective(rent);
		if (up != 1) {
			ret.setCoder(WebResult.Coder.C2001);
			logger.error("用户[{}]新增房源租赁信息-{}", user.getUserId(), ret.getMsg());
			houseBasicInfoService.deleteByPrimaryKey(basic.getId());
			return ret;
		}
		up = housePropertyInfoService.insertSelective(property);
		if (up != 1) {
			ret.setCoder(WebResult.Coder.C2001);
			logger.error("用户[{}]新增房源产权信息-{}", user.getUserId(), ret.getMsg());
			houseBasicInfoService.deleteByPrimaryKey(basic.getId());
			houseRentInfoService.deleteByPrimaryKey(basic.getId());
			return ret;
		}
		userLogService.info(user.getUserId(), SecurityUtils.getSubject().getSession().getHost(), "新增房源信息:{0}", basic.getId());
		return ret.setCoder(WebResult.Coder.SUCCESS);
	}
	
	/**
	 * 房源编辑
	 * @param basic
	 * @return
	 */
	@ApiOperation(value="房源编辑")
	@RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
	@ResponseBody
	@RequiresPermissions("house:edit")
	public WebResult<String> edit(@ApiParam(value="房源ID")@RequestParam(required=true)String houseId, HouseBasicInfo basic, HouseRentInfo rent, HousePropertyInfo property, @ApiParam(value="产权-备注")String propertyRemark) {
		WebResult<String> ret = new WebResult<>();
		SUser user = (SUser)SecurityUtils.getSubject().getPrincipal();
		logger.info("用户[{}]修改房源信息", user.getUserId());
		logger.debug("basic-{}\n rent-{}\n proerty-{}\n propertyRemark-{}", BeanUtil.getFieldsAsString(basic, true), BeanUtil.getFieldsAsString(rent, true), BeanUtil.getFieldsAsString(property, true), propertyRemark);
		basic.setModTime(new Date());
		
		rent.setId(houseId);
		rent.setModTime(basic.getModTime());
		
		property.setId(houseId);
		property.setModTime(basic.getModTime());
		property.setRemark(propertyRemark);
		
		HouseBasicInfoExample hbiEx = new HouseBasicInfoExample();
		HouseBasicInfoExample.Criteria hbiCr = hbiEx.createCriteria();
		hbiCr.andIdEqualTo(houseId);
		hbiCr.andDelFlagEqualTo(0);
		if (SecurityUtils.getSubject().isPermitted(Constant.PERMISSION_DATA_ALL)) { 
			// 拥有所有数据的操作权限
		}
		/*else if (SecurityUtils.getSubject().isPermitted(Constant.PERMISSION_DATA_UNDER_STORE)) {
			// 只能操作当前用户所在门店下的所有数据
			SUserVo userVo = (SUserVo)SecurityUtils.getSubject().getSession().getAttribute(Constant.USERVO_SESSION_KEY);
			EmployeeExample empEx = new EmployeeExample();
			empEx.createCriteria().andStoreIdEqualTo(userVo.getStoreId());
			empEx.setDistinct(true);
			List<Employee> empList = employeeService.selectByExample(empEx);
			List<String> userIdList = new ArrayList<String>();
			empList.stream().forEach(emp -> {
				userIdList.add(emp.getUserId());
			});
			hbiCr.andUserIdIn(userIdList);
		} */
		else { 
			// 只能操作当前用户下的数据
			hbiCr.andUserIdEqualTo(user.getUserId());
		}
		int up = houseBasicInfoService.updateByExampleSelective(basic, hbiEx);
		if (up != 1) {
			logger.error("{}-{}", ret.getMsg(), "更新返回影响记录条数为0");
			return ret;
		}
		houseRentInfoService.updateByPrimaryKeySelective(rent);
		housePropertyInfoService.updateByPrimaryKeySelective(property);
		userLogService.info(user.getUserId(), SecurityUtils.getSubject().getSession().getHost(), "修改房源信息:{0}", houseId);
		return ret.setCoder(WebResult.Coder.SUCCESS);
	}
	
	/**
	 * 房源查看
	 * @param id
	 * @return
	 */
	@ApiOperation(value="房源信息查看")
	@RequestMapping(value = "/view", method = {RequestMethod.GET, RequestMethod.POST})
	@ResponseBody
	@RequiresPermissions("house:view")
	public WebResult<HouseVo> view(@ApiParam(value="房源ID")@RequestParam(required=true)String id) {
		WebResult<HouseVo> ret = new WebResult<>();
		SUser user = (SUser)SecurityUtils.getSubject().getPrincipal();
		logger.info("用户[{}]查看房源信息：{}", user.getUserId(), id);
		HouseBasicInfoExample hbiEx = new HouseBasicInfoExample();
		HouseBasicInfoExample.Criteria hbiCr = hbiEx.createCriteria();
		hbiCr.andIdEqualTo(id);
		hbiCr.andDelFlagEqualTo(0);
		if (SecurityUtils.getSubject().isPermitted(Constant.PERMISSION_DATA_ALL)) { 
			// 拥有所有数据的操作权限
		} else if (SecurityUtils.getSubject().isPermitted(Constant.PERMISSION_DATA_ALL_HOUSES)) {
			// 拥有所有房源数据查看权限
		}
		/*else if (SecurityUtils.getSubject().isPermitted(Constant.PERMISSION_DATA_UNDER_STORE)) {
			// 只能操作当前用户所在门店下的所有数据
			SUserVo userVo = (SUserVo)SecurityUtils.getSubject().getSession().getAttribute(Constant.USERVO_SESSION_KEY);
			EmployeeExample empEx = new EmployeeExample();
			empEx.createCriteria().andStoreIdEqualTo(userVo.getStoreId());
			empEx.setDistinct(true);
			List<Employee> empList = employeeService.selectByExample(empEx);
			List<String> userIdList = new ArrayList<String>();
			empList.stream().forEach(emp -> {
				userIdList.add(emp.getUserId());
			});
			hbiCr.andUserIdIn(userIdList);
		} */
		else { 
			// 只能操作当前用户下的数据
			hbiCr.andUserIdEqualTo(user.getUserId());
		}
		List<HouseBasicInfo> basicList = houseBasicInfoService.selectByExample(hbiEx);
		if(basicList == null || basicList.isEmpty()) {
			ret.setCoder(WebResult.Coder.C2004);
			logger.warn("{}", ret.getMsg());
			return ret;
		}
		HouseBasicInfo basic = basicList.get(0);
		HouseVo vo = new HouseVo();
		vo.setBasic(basic);
		vo.setRent(houseRentInfoService.selectByPrimaryKey(id));
		vo.setProperty(housePropertyInfoService.selectByPrimaryKey(id));
		vo.setEmployee(employeeService.selectByPrimaryKey(basic.getUserId()));
		ret.setAttach(vo);
		userLogService.info(user.getUserId(), SecurityUtils.getSubject().getSession().getHost(), "查看房源信息:{0}", basic.getId());
		return ret.setCoder(WebResult.Coder.SUCCESS);
	}
	
	/**
	 * 房源删除
	 * @param id
	 * @return
	 */
	@ApiOperation(value="房源删除")
	@RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
	@ResponseBody
	@RequiresPermissions("house:delete")
	public WebResult<String> delete(@ApiParam(value="房源ID")@RequestParam(required=true)String id) {
		WebResult<String> ret = new WebResult<>();
		SUser user = (SUser)SecurityUtils.getSubject().getPrincipal();
		logger.info("用户[{}]删除房源信息：{}", user.getUserId(), id);
		HouseBasicInfoExample hbiEx = new HouseBasicInfoExample();
		HouseBasicInfoExample.Criteria hbiCr = hbiEx.createCriteria();
		hbiCr.andIdEqualTo(id);
		hbiCr.andDelFlagEqualTo(0);
		HouseRentInfoExample hriEx = new HouseRentInfoExample();
		HouseRentInfoExample.Criteria hriCr = hriEx.createCriteria();
		hriCr.andIdEqualTo(id);
		hriCr.andDelFlagEqualTo(0);
		HousePropertyInfoExample hpiEx = new HousePropertyInfoExample();
		HousePropertyInfoExample.Criteria hpiCr = hpiEx.createCriteria();
		hpiCr.andIdEqualTo(id);
		hpiCr.andDelFlagEqualTo(0);

		HouseFolowExample hfEx = new HouseFolowExample();
		HouseFolowExample.Criteria hfCr = hfEx.createCriteria();
		hfCr.andHouseIdEqualTo(id);
		hfCr.andDelFlagEqualTo(0);
		if (SecurityUtils.getSubject().isPermitted(Constant.PERMISSION_DATA_ALL)) { 
			// 拥有所有数据的操作权限
		} 
		/*else if (SecurityUtils.getSubject().isPermitted(Constant.PERMISSION_DATA_UNDER_STORE)) {
			// 只能操作当前用户所在门店下的所有数据
			SUserVo userVo = (SUserVo)SecurityUtils.getSubject().getSession().getAttribute(Constant.USERVO_SESSION_KEY);
			EmployeeExample empEx = new EmployeeExample();
			empEx.createCriteria().andStoreIdEqualTo(userVo.getStoreId());
			empEx.setDistinct(true);
			List<Employee> empList = employeeService.selectByExample(empEx);
			List<String> userIdList = new ArrayList<String>();
			empList.stream().forEach(emp -> {
				userIdList.add(emp.getUserId());
			});
			hbiCr.andUserIdIn(userIdList);
			hriCr.andUserIdIn(userIdList);
			hpiCr.andUserIdIn(userIdList);
			hfCr.andUserIdIn(userIdList);
		} */
		else { 
			// 只能操作当前用户下的数据
			hbiCr.andUserIdEqualTo(user.getUserId());
			hriCr.andUserIdEqualTo(user.getUserId());
			hpiCr.andUserIdEqualTo(user.getUserId());
			hfCr.andUserIdEqualTo(user.getUserId());
		}
		List<HouseBasicInfo> basicList = houseBasicInfoService.selectByExample(hbiEx);
		if(basicList == null || basicList.isEmpty()) {
			ret.setCoder(WebResult.Coder.C2004);
			logger.warn("{}", ret.getMsg());
			return ret;
		}
		HouseBasicInfo hbiUp = new HouseBasicInfo();
		hbiUp.setDelFlag(1);
		hbiUp.setModTime(new Date());
		int upRet = houseBasicInfoService.updateByExampleSelective(hbiUp, hbiEx);
		userLogService.info(user.getUserId(), SecurityUtils.getSubject().getSession().getHost(), "删除房源信息:{0}", id);
		logger.info("删除结果：{}个已删除", upRet);
		if (upRet < 1) {
			return ret.setCoder(WebResult.Coder.SUCCESS);
		}
		// 删除 rent property houseFlow
		HouseRentInfo hriUp = new HouseRentInfo();
		hriUp.setModTime(hbiUp.getModTime());
		hriUp.setDelFlag(1);
		houseRentInfoService.updateByExampleSelective(hriUp,hriEx);
		HousePropertyInfo hpiUp = new HousePropertyInfo();
		hpiUp.setDelFlag(1);
		hpiUp.setModTime(hbiUp.getModTime());
		housePropertyInfoService.updateByExampleSelective(hpiUp, hpiEx);
		HouseFolow hfUp = new HouseFolow();
		hfUp.setDelFlag(1);
		houseFolowService.updateByExampleSelective(hfUp, hfEx);
		return ret.setCoder(WebResult.Coder.SUCCESS);
	}
	
	/**
	 * 房源列表
	 * @param id
	 * @return
	 */
	@ApiOperation(value="房源列表")
	@RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
	@ResponseBody
	@RequiresPermissions("house:list")
	public WebResult<PageInfo<HouseBasicInfoVo>> list(
			@ApiParam(value="页面Size")@RequestParam(required=true) int rows, 
			@ApiParam(value="页")@RequestParam(required=true) int page,
			@ApiParam(value="过滤条件-面积范围min")Float areaMin,
			@ApiParam(value="过滤条件-面积范围max")Float areaMax,
			@ApiParam(value="过滤条件-房型")Integer houseRomNum,
			@ApiParam(value="过滤条件-用途(1租赁，2买卖，3车位，4商业，5写字楼)")Integer usage
			) {
		WebResult<PageInfo<HouseBasicInfoVo>> ret = new WebResult<>();
		SUser user = (SUser)SecurityUtils.getSubject().getPrincipal();
		logger.info("用户[{}]查看房源列表", user.getUserId());
		HouseBasicInfoExample ex = new HouseBasicInfoExample();
		HouseBasicInfoExample.Criteria cr = ex.createCriteria();
		cr.andDelFlagEqualTo(0);
		if(areaMin != null) {
			cr.andHouseAreaGreaterThanOrEqualTo(areaMin);
		}
		if (areaMax != null) {
			cr.andHouseAreaLessThanOrEqualTo(areaMax);
		}
		if (houseRomNum != null) {
			if (houseRomNum <=5) {
				cr.andHouseRomNumEqualTo(houseRomNum);
			} else {
				cr.andHouseRomNumGreaterThan(5);
			}
		}
		if (usage != null) {
			cr.andHouseUsageEqualTo(usage);
		}
		if (SecurityUtils.getSubject().isPermitted(Constant.PERMISSION_DATA_ALL)) { 
			// 拥有所有数据的操作权限
		} else if (SecurityUtils.getSubject().isPermitted(Constant.PERMISSION_DATA_ALL_HOUSES)) {
			// 拥有所有房源数据查看权限
		}
		/*else if (SecurityUtils.getSubject().isPermitted(Constant.PERMISSION_DATA_UNDER_STORE)) {
			// 只能操作当前用户所在门店下的所有数据
			SUserVo userVo = (SUserVo)SecurityUtils.getSubject().getSession().getAttribute(Constant.USERVO_SESSION_KEY);
			EmployeeExample empEx = new EmployeeExample();
			empEx.createCriteria().andStoreIdEqualTo(userVo.getStoreId());
			empEx.setDistinct(true);
			List<Employee> empList = employeeService.selectByExample(empEx);
			List<String> userIdList = new ArrayList<String>();
			empList.stream().forEach(emp -> {
				userIdList.add(emp.getUserId());
			});
			cr.andUserIdIn(userIdList);
			
		} */
		else { 
			// 只能操作当前用户下的数据
			cr.andUserIdEqualTo(user.getUserId());
		}
		ret.setAttach(houseBasicInfoService.selectPagedVoByExample(page, rows, ex));
		userLogService.info(user.getUserId(), SecurityUtils.getSubject().getSession().getHost(), "查看房源列表");
		return ret.setCoder(WebResult.Coder.SUCCESS);
	}
	
	
	/**
	 * 房源跟进列表
	 * @param id
	 * @return
	 */
	@ApiOperation(value="房源跟进列表")
	@RequestMapping(value = "/listFolow", method = {RequestMethod.GET, RequestMethod.POST})
	@ResponseBody
	@RequiresPermissions("houseFolow:list")
	public WebResult<PageInfo<HouseFolowVo>> listFolow(
			@ApiParam(value="页面Size")@RequestParam(required=true) int rows, 
			@ApiParam(value="页")@RequestParam(required=true) int page,
			@ApiParam(value="房源编号")@RequestParam(required=true) String houseId
			) {
		WebResult<PageInfo<HouseFolowVo>> ret = new WebResult<>();
		SUser user = (SUser)SecurityUtils.getSubject().getPrincipal();
		logger.info("用户[{}]查看房源跟进列表", user.getUserId());
		HouseFolowExample ex = new HouseFolowExample();
		HouseFolowExample.Criteria cr = ex.createCriteria();
		cr.andHouseIdEqualTo(houseId);
		cr.andDelFlagEqualTo(0);
		ret.setAttach(houseFolowService.selectPagedVoByExample(page, rows, ex));
		userLogService.info(user.getUserId(), SecurityUtils.getSubject().getSession().getHost(), "查看房源跟进：房源编号-{0}", houseId);
		return ret.setCoder(WebResult.Coder.SUCCESS);
	}
	
	
	/**
	 * 删除房源跟进
	 * @param id
	 * @return
	 */
	@ApiOperation(value="删除跟进")
	@RequestMapping(value = "/deleteFolow", method = {RequestMethod.GET, RequestMethod.POST})
	@ResponseBody
	@RequiresPermissions("houseFolow:delete")
	public WebResult<String> deleteFolow(
			@ApiParam(value="房源ID（多个以','隔开）")@RequestParam(required=true) String folowIds
			) {
		WebResult<String> ret = new WebResult<>();
		SUser user = (SUser)SecurityUtils.getSubject().getPrincipal();
		logger.info("用户[{}]删除跟进：{}", user.getUserId(), folowIds);
		List<String> list = StringUtil.getList(folowIds, ",");
		HouseFolowExample ex = new HouseFolowExample();
		HouseFolowExample.Criteria cr = ex.createCriteria();
		cr.andIdIn(list);
		cr.andDelFlagEqualTo(0);
		if (SecurityUtils.getSubject().isPermitted(Constant.PERMISSION_DATA_ALL)) { 
			// 拥有所有数据的操作权限
		} 
		/*else if (SecurityUtils.getSubject().isPermitted(Constant.PERMISSION_DATA_UNDER_STORE)) {
			// 只能操作当前用户所在门店下的所有数据
			SUserVo userVo = (SUserVo)SecurityUtils.getSubject().getSession().getAttribute(Constant.USERVO_SESSION_KEY);
			EmployeeExample empEx = new EmployeeExample();
			empEx.createCriteria().andStoreIdEqualTo(userVo.getStoreId());
			empEx.setDistinct(true);
			List<Employee> empList = employeeService.selectByExample(empEx);
			List<String> userIdList = new ArrayList<String>();
			empList.stream().forEach(emp -> {
				userIdList.add(emp.getUserId());
			});
			cr.andUserIdIn(userIdList);
			
		} */
		else { 
			// 只能操作当前用户下的数据
			cr.andUserIdEqualTo(user.getUserId());
		}
		HouseFolow up = new HouseFolow();
		up.setDelFlag(1);;
		houseFolowService.updateByExampleSelective(up, ex);
		userLogService.info(user.getUserId(), SecurityUtils.getSubject().getSession().getHost(), "删除房源跟进：{0}", folowIds);
		return ret.setCoder(WebResult.Coder.SUCCESS);
	}
	
	/**
	 * 添加跟进
	 * @param id
	 * @return
	 */
	@ApiOperation(value="添加跟进")
	@RequestMapping(value = "/addFolow", method = {RequestMethod.GET, RequestMethod.POST})
	@ResponseBody
	@RequiresPermissions("houseFolow:add")
	public WebResult<String> addFolow(
			@ApiParam(value="房源ID")@RequestParam(required=true) String houseId,
			@ApiParam(value="跟进内容")@RequestParam(required=true) String folowContent
			) {
		WebResult<String> ret = new WebResult<>();
		SUser user = (SUser)SecurityUtils.getSubject().getPrincipal();
		logger.info("用户[{}]添加跟进：{}-{}", user.getUserId(), houseId, folowContent);
		HouseFolow folow = new HouseFolow();
		folow.setId(sequenceService.genCommonFlowNo(null));
		folow.setHouseId(houseId);
		folow.setFolowContent(folowContent);
		folow.setCreateTime(new Date());
		folow.setUserId(user.getUserId());
		folow.setDelFlag(0);
		int up = houseFolowService.insert(folow);
		if (up != 1) {
			ret.setCoder(WebResult.Coder.C2001);
			logger.error("用户[{}]新增跟进信息-{}", user.getUserId(), ret.getMsg());
			return ret;
		}
		userLogService.info(user.getUserId(), SecurityUtils.getSubject().getSession().getHost(), "添加房源跟进：房源ID[{0}]跟进ID[{1}]", houseId, folow.getId());
		return ret.setCoder(WebResult.Coder.SUCCESS);
	}
	
	
	
	
	
}
